#!/bin/bash

if [ -z $1 ]
then
	echo "[*] $(basename $0) input.pdf"
	exit 0
fi

n=$(pdftk "$1" dump_data  | grep NumberOfPages | awk '{print $NF}')
pdftk "$1" burst output "%d.pdf"

echo "[*] total pages: $n"

echo -n "[*] files: "
for i in $(seq 1 1 $n)
do
	echo -n "$i.pdf "
done
echo
